﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace E1_eMart
{
    public partial class user_detail : System.Web.UI.Page
    {
        protected TaiKhoan gTaiKhoan = new TaiKhoan();
        protected int loaiTaiKhoan = -1;
        protected TaiKhoan taikhoanNguoiDang = new TaiKhoan();
        protected ThongTinTaiKhoan tttkNguoiDang = new ThongTinTaiKhoan();
        protected LoaiTaiKhoan loaiTaiKhoanNguoiDang = new LoaiTaiKhoan();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["username"] != null)
            {
                gTaiKhoan = (TaiKhoan)Session["username"];
                loaiTaiKhoan = (int)gTaiKhoan.MaLoaiTaiKhoan;
            }

            int maTk = Int32.Parse(Request.Params["mtk"].Trim());
            DataClasses1DataContext edata = new DataClasses1DataContext();


            var _taikhoan = from tk in edata.TaiKhoans
                            where tk.MaTaiKhoan == maTk
                            select tk;

            if (_taikhoan.Count() <= 0)
                return;
            taikhoanNguoiDang = _taikhoan.ToList()[0];
            var _thongTintaiKhoan = from tttk in edata.ThongTinTaiKhoans
                                    where tttk.MaTaiKhoan == taikhoanNguoiDang.MaTaiKhoan
                                    select tttk;
            tttkNguoiDang = _thongTintaiKhoan.ToList()[0];

            var item1 = from l in edata.LoaiTaiKhoans
                        where l.MaLoaiTaiKhoan == taikhoanNguoiDang.MaLoaiTaiKhoan
                        select l;
            loaiTaiKhoanNguoiDang = item1.ToList()[0];
        }
    }
}